<!DOCTYPE HTML>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <meta name="csrf-token" content="{{ csrf_token() }}">
        <title></title>
        <link rel="stylesheet" href="/css_system/common.css" />
        <link rel="stylesheet" href="/css_system/main.css" />
        <link href="/js_system/jQueryUI/jquery-ui.css" rel="stylesheet">
            <!-- 编辑器 -->
        <script type="text/javascript" src="/ckeditor/ckeditor.js"></script>
        <script type="text/javascript" src="/ckfinder/ckfinder.js"></script>
         <!-- 对话框 -->
        <link rel="stylesheet" href="/js_system/easydialog/easydialog.css" />
        <script type="text/javascript" src="/js_system/easydialog/easydialog.js"></script>
        <script type="text/javascript" src="/js_system/cueeasy.js"></script>
        <script type="text/javascript" src="/js_system/jquery.min.js"></script>

         <!-- 上传图片 -->
        <script type="text/javascript" src="/uploadify/jquery.uploadify.js" ></script>
        <link rel="stylesheet" type="text/css" href="/uploadify/uploadify.css">
        <script type="text/javascript" src="/js_system/books.js"></script>
        <style>
            .w500{
                width:500px;
            }
        </style>
    </head>
    <body>
        <div class="container">
            <div class="location clearfix">
                    <div class="here_area fl"><strong>当前位置：</strong>资讯管理&nbsp;&nbsp;&raquo;&nbsp;&nbsp;文章列表</div>
                    <div class="here_btn fr">
                        <a href="javascript:history.back()" class="btn btn_back">返回</a>
                        <a href="javascript:;" onclick="location.replace(location.href);" class="btn btn_refresh">刷新</a>
                    </div>
            </div>

            <div id="tabs">
                <ul>
                    <li><a href="#tabs-1">基本信息</a></li>
                    <li><a href="#tabs-2">文件管理</a></li>
                    <li><a href="#tabs-3">图片管理</a></li>
                </ul>


                <form action="/admin_system/books/editAction?bookId={{$entBookInfo->BookID}}" method="post">
                
                    <div id="tabs-1">
                        <table class="dataTable">
                            <input type="hidden" name="_token" value="{{csrf_token()}}">
                            
                            <tr>
                                <td class="ltd">视频类别</td>
                                <td class="rtd">
                                    <select name="video_type" class="select" style="width:200px;">
                                        @if($entBookInfo->video_type == 'gzsb')
                                            <option value="lhdd">老侯代读</option>
                                            <option value="gzsb" selected>国政书吧</option>
                                        @else
                                            <option value="lhdd" selected>老侯代读</option>
                                            <option value="gzsb">国政书吧</option>
                                        @endif
                                    </select>
                                </td>
                            </tr>


                            <tr>
                                <td class="ltd">书籍类别</td>
                                <td class="rtd">
                                    <select style="width:200px;" class="select" id="TypeIDSelect" name="TypeIDSelect">
                                        <option value="0">请选择</option>
                                        @foreach($SelectType as $select)
                                            @if($select->TypeID==$entBookInfo->TypeID)
                                                <option selected="selected" value="{{$select->TypeID}}">&nbsp;&nbsp;{{$select->TypeName}}</option>
                                            @else
                                                <option value="{{$select->TypeID}}">&nbsp;&nbsp;{{$select->TypeName}}</option>
                                            @endif
                                        @endforeach
                                    </select>
                                    <span class="text-red pl10">*必选</span>
                                </td>
                            </tr>


                            <tr>
                                <td class="ltd">书籍名称</td>
                                <td class="rtd">
                                    <input id="txtBookTitle" value="{{$entBookInfo->BookTitle}}" class="input-text" type="text" name="txtBookTitle" />
                                    <span class="text-red pl10">*必填</span>
                                </td>
                            </tr>

                            <tr>
                                <td class="ltd">演说人名称</td>
                                <td class="rtd"><input type="text" class="input-text w500" name="author" value="{{$entBookInfo->author}}"></td>
                            </tr>
                            <tr>
                                <td class="ltd">播放次数</td>
                                <td class="rtd">
                                    <input value="{{$entBookInfo->ReadNumber}}" class="input-text w500" type="text" name="txtReadNumber" />
                                </td>
                            </tr>

                            <tr>
                                <td class="ltd">发布日期</td>
                                <td class="rtd">
                                    <input value="{{$entBookInfo->publish_date}}" class="input-text w500" type="date" name="txtPublishDate" />
                                </td>
                            </tr>

                            <tr>
                                <td class="ltd">简介</td>
                                <td class="rtd">
                                    <textarea id="txtBookDesc"  class="textarea w500" name="txtBookDesc">{{$entBookInfo->BookDesc}}</textarea>  
                                </td>
                            </tr>

                            <tr>
                                <td class="ltd">标签</td>
                                <td class="rtd">
                                    <textarea id="txtBookDesc"  class="textarea w500" name="tags">{{$entBookInfo->tags}}</textarea>
                                    {{--<p>--}}
                                        {{--@foreach($tags as $k => $tag)--}}
                                            {{--<label for="tag-{{$k}}">--}}
                                                {{--<span>{{$tag->tag}}</span>--}}
                                                {{--@if(in_array($tag->tag,$entBookInfo->tags))--}}
                                                    {{--<input type="checkbox" id="tag-{{$k}}" name="tags[]" value="{{$tag->tag}}" checked>--}}
                                                {{--@else--}}
                                                    {{--<input type="checkbox" id="tag-{{$k}}" name="tags[]" value="{{$tag->tag}}">--}}
                                                {{--@endif--}}
                                            {{--</label>--}}
                                        {{--@endforeach--}}
                                    {{--</p>--}}
                                </td>
                            </tr>


                            <tr>
                                <td class="ltd">视频URL</td>
                                <td class="rtd">
                                    <input  class="input-text w500"  id="txtVideoUrl" name="mp4" value="{{$entBookInfo->mp4}}">
                                </td>
                            </tr>
                            <tr>
                                <td class="ltd">音频URL</td>
                                <td class="rtd">
                                    <input class="input-text w500"  id="txtAudioUrl" name="mp3" value="{{$entBookInfo->mp3}}">
                                </td>
                            </tr>
                            <tr>
                                <td class="ltd">文章URL</td>
                                <td class="rtd">
                                    <input class="input-text w500"  name="article" value="{{$entBookInfo->article}}">
                                </td>
                            </tr>
                          

                            <tr>
                                <td class="ltd">是否免费</td>
                                <td class="rtd">
                                   <span class="Radio">
                                        <label ><input type="radio" value="1" @if($entBookInfo->IsGratis == 1) checked @endif name="RadIsGratis" />是</label>
                                        <label ><input type="radio" value="0" @if($entBookInfo->IsGratis == 0) checked @endif name="RadIsGratis" />否</label>
                                    </span>
                                </td>
                            </tr>
                            <tr>
                                <td class="ltd">显示</td>
                                <td class="rtd">
                                    <span class="Radio">
                                       <?php $IsShow=$entBookInfo->IsShow;?>
                                        <input id="RadIsShow1"  type="radio" value="1" <?php if($IsShow==1){ echo 'checked="checked"';}  ?>  name="RadIsShow" /><label for="RadIsShow1">显示</label>
                                        <input id="RadIsShow0" type="radio" value="0" <?php if($IsShow==0){ echo 'checked="checked"';} ?>  name="RadIsShow" /><label for="RadIsShow0">隐藏</label>
                                     </span>
                                </td>
                            </tr>
                            <tr>
                                <td class="ltd">排序</td>
                                <td class="rtd">
                                    <input id="txtSortNumber"  value="{{$entBookInfo->SortNumber}}" class="input-text" style="width: 50px;" type="text" name="txtSortNumber" />
                                    <span class="text-red pl10">*必填</span>
                                </td>
                            </tr>
                        </table>
                    </div>




                    <div id="tabs-2">

                        <table class="dataTable">
                        
                                <tr>
                                    <td class="ltd">封面图片<br/></td>
                                    <td>
                                         <div class="PreviewImg">
                                            <div id="prev_bookimg"
                                                 style="padding:0px; background:#fff url('/images_system/yulan.gif') no-repeat center;"
                                                 class="PreviewTD delfile_bookimg">
                                                @if($entBookInfo->book_img!='')
                                                   <img src="{{$entBookInfo->book_img}}">
                                                @endif
                                            </div>
                                        </div>
                                    </td>


                                    <td>
                                        <input id="file_upload_bookimg"  type="file">
                                        <input id="File_bookimg" value="{{$entBookInfo->book_img}}" name="File_bookimg" readonly>
                                    </td>

                                    <td class="rtd">
                                        <a id="addvideoFile_bookimg"
                                           class="button button-primary hide"
                                           onclick="$('#file_upload_bookimg').uploadify('upload','*');return false;">上传</a>
                                        <a id="delvideoFile_bookimg"  onclick="delFile('bookimg'); return false" class="button button-primary">删除</a>

                                        <script type="text/javascript">
                                            <?php $timestamp = time();?>
                                            $(function () {
                                                $('#file_upload_bookimg').uploadify({
                                                    'buttonText': "请选择文件",
                                                    'fileTypeExts': '*.jpg;*.gif;*.png;*.jpeg',
                                                    'auto': false,
                                                    'formData': {
                                                        'timestamp': '<?php echo $timestamp;?>',
                                                        'token': '<?php echo md5('unique_salt' . $timestamp);?>'
                                                    },
                                                    'swf': '/uploadify/uploadify.swf',
                                                    'uploader': '/uploadify/uploadify.php',
                                                    'onUploadSuccess': function (file, data, response) {
                                                        if (data != '') {
                                                            $('#File_bookimg').val(data);
                                                            $('#addvideoFile_bookimg').hide();
                                                            $('#delvideoFile_bookimg').show();
                                                            $('#prev_bookimg').html('<a target="_blank" href=' + data + '><img src=' + data + '></a>');
                                                        }
                                                    }
                                                });
                                            });
                                        </script>

                                    </td>
                                </tr>

                            <tr>
                                <td class="ltd">列表图片<br/></td>
                                <td>
                                    <div class="PreviewImg">
                                        <div id="prev_bgimg"
                                             style="padding:0px; background:#fff url('/images_system/yulan.gif') no-repeat center;"
                                             class="PreviewTD delfile_bgimg">
                                            @if($entBookInfo->bg_img!='')
                                                <img src="{{$entBookInfo->bg_img}}">
                                            @endif
                                        </div>
                                    </div>
                                </td>


                                <td>
                                    <input id="file_upload_bgimg" type="file">
                                    <input id="File_bgimg" value="{{$entBookInfo->bg_img}}" name="bg_img" >
                                </td>

                                <td class="rtd">

                                    <a id="addvideoFile_bgimg"  class="button button-primary" onclick="$('#file_upload_bgimg').uploadify('upload','*');">上传</a>
                                    <a id="delvideoFile_bgimg"  onclick="delFile('bgimg');" class="button button-primary">删除</a>

                                    <script type="text/javascript">
                                        <?php $timestamp = time();?>
                                        $(function () {
                                                $('#file_upload_bgimg').uploadify({
                                                    'buttonText': "请选择文件",
                                                    'fileTypeExts': '*.jpg;*.gif;*.png;*.jpeg',
                                                    'auto': false,
                                                    'formData': {
                                                        'timestamp': '<?php echo $timestamp;?>',
                                                        'token': '<?php echo md5('unique_salt' . $timestamp);?>'
                                                    },
                                                    'swf': '/uploadify/uploadify.swf',
                                                    'uploader': '/uploadify/uploadify.php',
                                                    'onUploadSuccess': function (file, data, response) {
                                                        if (data != '') {
                                                            $('#File_bgimg').val(data);
                                                            $('#addvideoFile_bgimg').hide();
                                                            $('#delvideoFile_bgimg').show();
                                                            $('#prev_bgimg').html('<a target="_blank" href=' + data + '><img src=' + data + '></a>');
                                                        }
                                                    }
                                                });
                                            });
                                    </script>

                                </td>
                            </tr>


                                <tr>
                                    <td class="ltd">PPT文件<br/></td>
                                    <td>
                                        <div class="PreviewImg">
                                            <div id="PreviewPpt" class="PreviewTD delfile_ppt">
                                                @if($entBookInfo->ppt !='')
                                                    <a target="_blank" href="{{$entBookInfo->ppt}}">下载</a>
                                                @endif
                                            </div>
                                        </div>
                                    </td>
                                    <td>
                                        <input id="File_ppt" value="{{$entBookInfo->ppt}}" name="ppt">
                                        <input id="ppt_upload" name="ppt_upload" type="file">
                                    </td>
                                    <td class="rtd">
                                        @if($entBookInfo->ppt =='')
                                            <a id="addvideoFile_ppt" style="font-weight:normal;color:#FFF; " class="button button-primary"
                                               href="javascript:$('#ppt_upload').uploadify('upload','*');">上传</a>
                                            <a id="delvideoFile_ppt" style="font-weight:normal;color:#FFF; display: none;" onclick="delFile('ppt');" class="button button-primary"
                                               href="javascript:void(0);">删除</a>
                                        @else
                                            <a id="addvideoFile_ppt" style="font-weight:normal;color:#FFF; display: none;" class="button button-primary"
                                               href="javascript:$('#ppt_upload').uploadify('upload','*');">上传</a>
                                            <a id="delvideoFile_ppt" style="font-weight:normal;color:#FFF; " onclick="delFile('ppt');" class="button button-primary"
                                               href="javascript:void(0);">删除</a>
                                        @endif
                                        <script type="text/javascript">
                                            <?php $timestamp = time();?>
                                            $(function () {
                                                    $('#ppt_upload').uploadify({
                                                        'buttonText': "请选择文件",
                                                        'fileTypeExts': '*.zip;*.ppt;',
                                                        'auto': false,
                                                        'formData': {
                                                            'timestamp': '<?php echo $timestamp;?>',
                                                            'token': '<?php echo md5('unique_salt' . $timestamp);?>'
                                                        },
                                                        'swf': '/uploadify/uploadify.swf',
                                                        'uploader': '/uploadify/uploadify.php',
                                                        'onUploadSuccess': function (file, data, response) {
                                                            if (data != '') {
                                                                $('#File_ppt').val(data);
                                                                $('#delvideoFile_ppt').show();
                                                                $('#PreviewPpt').html('<a target="_blank" href=' + data + '>下载</a>');
                                                            }
                                                        }
                                                    });
                                                });
                                        </script>
                                    </td>
                                </tr>


                        </table>
                    </div>


                    <div id="tabs-3">
                        <input type="hidden" value="{{$entBookInfo->BookID}}" id="hiImgID" name="hiImgID">
                        <table class="dataTable">
                            <tr>
                                <td class="ltd">排序<br/></td>
                                <td class="rtd">
                                    <input id="txtPPTSortNumber" value="1000" class="input-text" style="width: 50px;" type="text" name="txtPPTSortNumber"/>
                                </td>
                            </tr>
                            <tr>
                                <td class="ltd">PPT图片<br/></td>
                                <td class="rtd">
                                    <div class="PreviewImg">
                                        <div id="PreviewPPT"
                                             style="padding:0px; background:#fff url(/images_system/yulan.gif) no-repeat center;"
                                             class="PreviewTD"></div>
                                    </div>
                                    <input type="hidden" id="File_4" name="File_4">
                                    <input id="PPT_file_upload" name="PPT_file_upload" type="file">
                                    <a id="addvideoFile_4" style="font-weight:normal;color:#FFF; " class="button button-primary"
                                       href="javascript:$('#PPT_file_upload').uploadify('upload','*');">上传</a>
                                    <a id="delvideoFile_4" style="font-weight:normal;color:#FFF; display: none;" onclick="delFile(4);" class="button button-primary"
                                       href="javascript:void(0);">删除</a>
                                    <script type="text/javascript">
                                        <?php $timestamp = time();?>
                                        $(function () {
                                            $('#PPT_file_upload').uploadify({
                                                'buttonText': "请选择文件",
                                                'fileTypeExts': '*.jpg;*.gif;*.png;*.jpeg',
                                                'auto': false,
                                                'formData': {
                                                    'timestamp': '<?php echo $timestamp;?>',
                                                    'token': '<?php echo md5('unique_salt' . $timestamp);?>'
                                                },
                                                'swf': '/uploadify/uploadify.swf',
                                                'uploader': '/uploadify/uploadify.php',
                                                'onUploadSuccess': function (file, data, response) {
                                                    if (data != '') {
                                                        $('#File_4').val(data);
                                                        $('#PreviewPPT').html('<a target="_blank" href=' + data + '><img src=' + data + '></a>');
                                                        addPPT();
                                                    }
                                                }
                                            });
                                        });
                                    </script>

                                </td>
                            </tr>
                             <tr>
                                <td class="ltd">PPT图片预览<br/></td>
                                <td class="rtd">
                                    <ul id="pptImg" class="clearfix preview-tiems">
                                        @if(count($entBookImg)>0)
                                            @foreach($entBookImg as $dataBookImg)
                                                <li id="pptimg_{{$dataBookImg->BookImgID}}">
                                                    <img src="{{$dataBookImg->FilePath1}}">
                                                    <p onclick="ajaxDelPPTFile({{$dataBookImg->BookImgID}});" class="del-ppt">删除</p>
                                                </li>
                                            @endforeach
                                        @endif
                                    </ul>
                                </td>
                            </tr>
                        </table>
                    </div>


                    <div class="contBtn">
                        <table class="dataTable">
                            <tfoot>
                            <tr>
                                <td class="ltd"></td>
                                <td class="rtd">
                                    <input id="btnAddFrom" onclick="return CheckindexFrom();" type="submit" class="btn btn_save"  name="btnFrom" value="保存" >
                                </td>
                            </tr>
                            </tfoot>
                        </table>
                    </div>



                </form> 

            </div>

        </div>	
    </body>
</html>
<script src="/js_system/jQueryUI/jquery-ui.js"></script>
<script src="/js_system/jqueryui.js"></script>